<template>
  <el-aside width>
    <el-menu
      class="el-menu-vertical-demo"
      background-color="#222c32"
      text-color="#fff"
      active-text-color="#409eff"
      router
    >
      <el-submenu v-for="(menu,index) in menus" :key="index" :index="menu.index">
        <template slot="title">
          <i class="el-icon-menu"></i>
          <span>{{menu.name}}</span>
        </template>
        <el-menu-item
          v-for="(subMenu,subIndex) in menu.subMenus"
          :route="{ path: subMenu.path }"
          :key="subIndex"
          :index="menu.index"
        >
          <span style="margin-left: 9px;">{{subMenu.name}}</span>
        </el-menu-item>
      </el-submenu>
    </el-menu>
  </el-aside>
</template>

<script>
import { menus } from "@/constants/constants.js";

export default {
  data() {
    return {
      menus: menus
    };
  }
};
</script>

<style scoped>
.el-menu-vertical-demo {
  height: calc(100vh - 60px - 70px);
  border-right: none;
}

.el-menu-vertical-demo:not(.el-menu--collapse) {
  width: 200px;
  min-height: 400px;
}

.el-aside {
  background: rgba(34, 44, 50, 1);
  color: #fff;
}

.router-link-active {
  color: #409eff !important;
  font-weight: bold;
}
</style>
